package com.sun.services.users.repository;


import com.sun.commons.base.AbstractRepository;
import com.sun.entitys.users.User;
import com.sun.dto.users.UserDto;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

/**
 * MP自动填充Handler
 *
 * @Author sun
 * @CreateTime 2025/9/6 21:06
 */
public interface UserRepository extends AbstractRepository<User, Long> {
    @Query("""
            
             SELECT  new com.sun.dto.users.UserDto(o.id, o.name,
                 o.code, o.description,
                 o.remark, o.enabled, o.username,
                 o.password, o.phone, o.openid,
                             o.type,
                 o.createTime, o.updateTime, o.createrName,
                 o.updaterName, o.createrId, o.updaterId)   FROM User o
            WHERE o.username = :username and o.deleted = 0
            """)
    UserDto findByUsername(String username);


}
